//
//  UIBarButtonItem+Extension.swift
//  Weibo10
//
//  Created by Leon on 15/10/25.
//  Copyright © 2015年 Leon. All rights reserved.
//

import UIKit

extension UIBarButtonItem {
    
    ///  便利构造函数
    ///
    ///  - parameter imageName: 图片名称
    ///  - parameter target:    监听者
    ///  - parameter selecter:  监听方法
    ///
    ///  - returns: UIBarButtonItem
    convenience init(imageName: String, target: AnyObject?, selecter: String?) {
        
        let button = UIButton(imageName: imageName, backImageName: nil)
        
        if let selecter = selecter {
            
            button.addTarget(target, action:Selector(selecter) , forControlEvents: .TouchUpInside)
        }
        self.init(customView: button)
    }
}
